﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KeyboardImageViewer
{
    /// <summary>
    /// Interaction logic for ImageDetail.xaml
    /// </summary>
    public partial class ImageDetail : Window
    {
        private ImageManager manager;

        public ImageDetail(ImageManager manager, string imagePath)
        {
            this.manager = manager;

            InitializeComponent();

            this.manager.Config.ApplyWindowSize("ImageDetail", this);

            BitmapImage bitmapImage = new BitmapImage();
            bitmapImage.BeginInit();
            bitmapImage.UriSource = new Uri(imagePath);
            bitmapImage.EndInit();

            this.mainImage.Source = bitmapImage;
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.manager.Config.SaveWindowSize("ImageDetail", this);
        }
    }
}
